combine: differentiate dyes by dye_profile instead of excluding them - #1617
Alistair-Afton wants to merge 2 commits into
Conversation
|
There are unfixed vanilla game bugs regarding dyes with incorrect or missing dye profiles (specifically, dyes and dyed cloth purchased from merchants sometimes have incorrect or missing dye information). Until those bugs are fixed, I'm not comfortable with possibly combining bugged and unbugged dye stacks, at least not until the consequences of doing this are known and understood. |
|
@ab9rf Good point. Dyes missing their dye_profile now get a unique comparison key each, so they can never be merged into another stack or each other. Unprofiled non-dye powders (flour and such) are unaffected, and properly profiled dyes still combine per profile. |
Blanket-excluding dyes prevented combining them at all. Mixed dyes share mat_type/mat_index with their components, so keying POWDER_MISC items on the dye_profile fingerprint keeps mixes distinct while allowing identical dyes to stack. fixes DFHack/dfhack#5849
Merchant dyes can end up with missing or incorrect dye info due to unfixed vanilla bugs. Give such items a unique comparison key so they stay uncombined rather than being merged into an unrelated stack.
af1d3d3 to
9df2394
Compare
|
Follow-up on the unprofiled-dye handling: the embedded Regarding dyes with incorrect (rather than missing) profiles: they still merge only with items carrying an identical profile, so a wrong profile can never collapse a different blend — the residual risk is two items sharing the same incorrect profile, which are indistinguishable to begin with. |
Summary
Implements the real fix for DFHack/dfhack#5849.
Since 52.03, dye powders carry an embedded
dye_profile(color index plus the component material lists). Mixed dyes sharemat_type/mat_indexwith their components, so combining stacks by material alone reverts a mixed dye to one of its components — the bug that #1596 avoided by excluding dyes from combining entirely.This change fingerprints
dye_profileinto the comparison key forPOWDER_MISCitems, so dyes combine again — but only with an identical blend.Dyes whose profile was lost to the vanilla merchant bug are never merged: the embedded
dye_profilecompound is always present on real items, so the unprofiled state is detected viacolor_index == -1, and each such item gets a unique comparison key. Non-dye powders (flour, etc.) are unaffected.Test plan
test/combine.luacovers same/different profiles, mixed-vs-component keys, unprofiled dyes (both embedded-empty and absent profile), and non-dye powders